#include <iostream>
using namespace std;

struct ChildNode
{
    int child;
    struct ChildNode *next;
};

struct ParentNode
{
    int i;  //1表示红色0表示无色
    struct ChildNode *next;
};

void Count(struct ParentNode *arr, int &count, struct ChildNode *z)
{
    while(z != NULL)
    {
        if (arr[z->child].i == 1)
        {
            (count)++;
        }
        Count(arr, count, arr[z->child].next);
        z = z->next;
    }
}

int main() 
{
    int n = 0;
    cin >> n;
    int a = 0;

    struct ParentNode arr[n];
    struct ChildNode *z;
    for (int i = 0; i < n; i++)
    {
        arr[i].i = 0;
        arr[i].next = NULL;
    }
    for (int i = 1; i < n; i++)
    {
        cin >> a;
        struct ChildNode *p = new struct ChildNode;
        p->child = i;
        p->next = NULL;
        z = arr[a-1].next;
        if (z == NULL)
        {
            arr[a-1].next = p; 
        }
        else 
        {
            while(z->next != NULL)
            {
                z = z->next;
            }
            z->next = p;
        }
    }
    char color;
    for (int i = 0; i < n; i++)
    {
        cin >> color;
        switch(color)
        {
            case 'R':
                arr[i].i = 1;
                break;

        }
    }
    int q = 0;
    cin >> q;
    int x = 0;
    int count = 0;
    for (int i = 0; i < q; i++)
    {
        count = 0;
        cin >> x;
        z = arr[x-1].next;
        if (arr[x-1].i == 1)
        {
            count++;
        }
        Count(arr, count, z);
        
        cout << count << endl;
    }
    return 0;
}
//724

class Solution {
    public int pivotIndex(int[] nums) {
        int index = 0;
        int len = nums.length;
        for (int i = 1; i < len; i++) {
            nums[i] = nums[i] + nums[i-1];
        }
        if (nums[len-1] - nums[0] == 0) {
            return index;
        }
        for (int i = 1; i < len; i++) {
            if (nums[len-1]-nums[i] == nums[i-1]) {
                index = i;
                return index;
            }
        }
        return -1;
    }
}

//238

class Solution {
    public int[] productExceptSelf(int[] nums) {
        int len = nums.length;
        int[] dp1 = new int[len];
        int[] dp2 = new int[len];
        int[] answer = new int[len];
        dp1[0] = nums[0];
        for (int i = 1; i < len; i++) {
            dp1[i] = nums[i] * dp1[i-1];
        }
        dp2[len-1] = nums[len-1];
        for (int i = len-2; i >= 0; i--) {
            dp2[i] = nums[i] * dp2[i+1];
        }
        for (int i = 0; i < len; i++) {
            if (i == 0) {
                answer[0] = dp2[1];
            }
            else if (i == len-1) {
                answer[i] = dp1[i-1];
            }
            else {
                answer[i] = dp1[i-1] * dp2[i+1];
            }
        }
        return answer;
    }
}
